package com.guice.web.guice_webapp_example.service;

import com.google.inject.Inject;
import com.google.inject.Singleton;
import com.guice.web.guice_webapp_example.mybatis.domain.User;
import com.guice.web.guice_webapp_example.mybatis.mapper.UserMapper;

@Singleton
public class UserService {
    @Inject
    UserMapper userMapper;

    public User findById(Integer userId){
        return userMapper.getUser(userId);
    }
    public User save(String name,Integer age,String address){
        User user = new User();
        user.setAge(age);
        user.setName(name);
        user.setAddress(address);
        userMapper.save(user);
        return user;
    }
}
